﻿using System;
using System.IO;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using System.Data.Odbc;

namespace GUI_Test
{
    //public class Access : IDbConnection
    //{
    //    OdbcConnection conn = new OdbcConnection();
    //    public Access (string Filename, string pwd)
    //    {
    //        conn.ConnectionString = "Driver=" + Filename + ";" +
                            
    //}

    public partial class SubFormAccessConnection : Form
    {
        public SubFormAccessConnection()
        {
            InitializeComponent();
        }

        private void label1_Click(object sender, EventArgs e)
        {

        }

        private void SubFormAccess_Load(object sender, EventArgs e)
        {
            this.MaximizeBox = false;
            this.MinimizeBox = false;
        }

        private void btnOk_Click(object sender, EventArgs e)
        {
            if (!validateUserInput())
            {
                return;
            }
        }

        private bool validateUserInput()
        {
            bool isValid = true;
            if (textBoxAccessFilename.Text.Trim() == string.Empty)
            {
                MessageBox.Show("File name is required.", "Error: Invalid entry");
                isValid = false;
            }
            return isValid;
        }

        private void btnBrowse_Click(object sender, EventArgs e)
        {
            string input = string.Empty;
            //string strFileName = string.Empty;

            OpenFileDialog openDialog = new OpenFileDialog();
            openDialog.Filter = "mdb files (*.mdb) |*.mdb | accdb files (*.accdb) |*.accdb";
            openDialog.InitialDirectory = "C:";
            openDialog.Title = "Select your Access file";

            if (openDialog.ShowDialog() == DialogResult.OK)
            {
                textBoxAccessFilename.Text = openDialog.FileName;
            }
        }

        private void btnCancel_Click(object sender, EventArgs e)
        {
            this.Close();
        }

        //private void btnTestConnection_Click(object sender, EventArgs e)
        //{
        //    if (!isConnected())
        //    {
        //        return;
        //    }
        //}

        //public bool isConnected()
        //{
        //    try
        //        using (ConnectionSt
    }
}
